using System;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;

namespace BizTalk.BuildGenerator.UI
{
    public partial class Host : Form
    {
        public Host()
        {
            InitializeComponent();
        }

        private void ShowNewForm(object sender, EventArgs e)
        {
            var frm = new WizardForm {MdiParent = this};
            frm.Show();
        }

        private void OpenFile(object sender, EventArgs e)
        {
            var frm = new OpenWizardForm(this) {MdiParent = this};
            frm.Show();
        }


        private static void ExitToolsStripMenuItemClick(object sender, EventArgs e)
        {
            Application.Exit();
        }


        private void CascadeToolStripMenuItemClick(object sender, EventArgs e)
        {
            LayoutMdi(MdiLayout.Cascade);
        }

        private void TileVerticleToolStripMenuItemClick(object sender, EventArgs e)
        {
            LayoutMdi(MdiLayout.TileVertical);
        }

        private void TileHorizontalToolStripMenuItemClick(object sender, EventArgs e)
        {
            LayoutMdi(MdiLayout.TileHorizontal);
        }

        private void CloseAllToolStripMenuItemClick(object sender, EventArgs e)
        {
            foreach (var childForm in MdiChildren)
            {
                childForm.Close();
            }
        }

        private static void ContentsToolStripMenuItemClick(object sender, EventArgs e)
        {
            var path = AppDomain.CurrentDomain.BaseDirectory + @"\Build Generator.mht";
            if (File.Exists(path))
                Process.Start(path);
        }

        private static void AboutToolStripMenuItemClick(object sender, EventArgs e)
        {
            var frm = new ApplicationAboutBox();
            frm.ShowDialog();
        }
    }
}